import Request from "@/common/utils/request/index";
import { PageList } from "@/types/model/pageList.model";
import { Brand } from "@/types/model/product/vos/brand.vo";

enum Api {
  GetBrandsList = "/jeecgboot/posBrands/list",
  AddBrand = "/jeecgboot/posBrands/add",
  EditBrand = "/jeecgboot/posBrands/edit",
  DeleteBrand = "/jeecgboot/posBrands/delete",
  UpdateStatus = "/jeecgboot/posBrands/updateStatus",
}

export const getBrands = (params: any) => {
  return Request.getInstance().send<PageList<Brand>>({
    url: Api.GetBrandsList,
    method: "GET",
    params,
  });
};

export const addBrand = (params: any) => {
  return Request.getInstance().send<void>({
    url: Api.AddBrand,
    method: "POST",
    data: params,
  });
};

export const editBrand = (params: any) => {
  return Request.getInstance().send<void>({
    url: Api.EditBrand,
    method: "POST",
    data: params,
  });
};

export const deleteBrand = (id: string) => {
  return Request.getInstance().send<void>({
    url: Api.DeleteBrand,
    method: "POST",
    params: {
      id,
    },
  });
};

export const updateStatus = (params: { id: string; status: "1" | "2" }) => {
  return Request.getInstance().send<string>({
    url: Api.UpdateStatus,
    method: "POST",
    data: params,
  });
};
